/* nTube overrider for YouTube chat */
const __shameless_ntube_moment = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function () {
	if (arguments.length >= 2) {
		const rURL = arguments[1];
		if (rURL.startsWith("https://signaler-pa.youtube.com/punctual/v1/chooseServer")) {
			arguments[1] = rURL.replace("https://signaler-pa.youtube.com/punctual/v1/chooseServer?key=", "/proxy/chooseServer?uzc=signaler-pa.youtube.com/punctual/v1/chooseServer&uzs=1&uzm=sr-ip-v2&key=");
		} else if (rURL.startsWith("https://signaler-pa.youtube.com/punctual/multi-watch/channel")) {
			arguments[1] = rURL.replace("https://signaler-pa.youtube.com/punctual/multi-watch/channel?", "/proxy/signalChannel?uzc=signaler-pa.youtube.com/punctual/multi-watch/channel&uzs=1&uzm=sr-ip-v2&");
		}
	}
	return __shameless_ntube_moment.apply(this, [].slice.call(arguments));
};
/* END */
